﻿Imports System.Windows.Forms
Imports System.IO
Public Class DlgXMLGenerater
    Dim Mysql As New ClsSQLhelper
    Dim Strsql As String
    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
        Try
            Dim DSXMLGen As New DataSet
            Me.EventLog1.WriteEntry(Me.Name & " : " & Me.TxtStrsql.Text, EventLogEntryType.Information, 1)
            DSXMLGen = Mysql.GetMYSQLDataset(Me.TxtStrsql.Text, "Dataset1", "Table1")
            If DSXMLGen.Tables(0).Rows.Count > 0 Then
                With SaveFileDialog1
                    .Title = "บันทึก"
                    .Filter = "XML File|*.xml"
                    .FileName = "Table1.xml"
                    If .ShowDialog() = Windows.Forms.DialogResult.Cancel Then Exit Sub
                    DSXMLGen.WriteXml(SaveFileDialog1.FileName)
                End With

            End If
            Me.DialogResult = System.Windows.Forms.DialogResult.OK
            Me.Close()
        Catch ex As Exception

        End Try


    End Sub

    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()
    End Sub

    Private Sub DlgXMLGenerater_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub
End Class
